%
% Copyright (c) 2016-2017 Petr Gotthard <petr.gotthard@centrum.cz>
% All rights reserved.
% Distributed under the terms of the MIT License. See the LICENSE file.
%
{application, lorawan_server,
    [{description, "LoRaWAN Application Server"},
    {vsn, "0.4.12"},
    {modules, []},
    {registered, []},
    {mod, {lorawan_app, []}},
    {env, [
        {plugins, [
            {<<"semtech-mote">>, lorawan_application_semtech_mote},
            {<<"microchip-mote">>, lorawan_application_microchip_mote},
            {<<"websocket">>, lorawan_application_websocket}
        ]},
        {packet_forwarder_listen, [{port, 1680}]},
        {http_admin_listen, [{port, 8080}]},
        {http_admin_credentials, {<<"admin">>, <<"admin">>}},
        {http_content_security, <<"default-src * data: 'unsafe-inline' 'unsafe-eval';">>},
        {retained_rxframes, 50},
        {websocket_timeout, 3600000}, % ms
        % regional parameters
        {join1_delay, 5000000}, % us
        {join2_delay, 6000000}, % us
        {rx1_delay, 1000000}, % us
        {rx2_delay, 2000000}, % us
        {regions, [
            {<<"EU863-870">>, [
                % default RX2 frequency (MHz) and data rate (DRx)
                {rx2_rf, {869.525, <<"SF12BW125">>, <<"4/5">>}}
            ]},
            {<<"US902-928">>, [
                {rx2_rf, {923.3, <<"SF12BW500">>, <<"4/5">>}}
            ]},
            % Multitech Private Hybrid Mode
            % http://www.multitech.net/developer/software/lora/introduction-to-lora
            {<<"US902-928-PR">>, [
                {join1_delay, 1000000},
                {join2_delay, 2000000},
                {rx1_delay, 1000000},
                {rx2_delay, 2000000},
                % although the frequency is not used for this region, it is sent in RXParamSetupReq
                {rx2_rf, {923.3, <<"SF12BW500">>, <<"4/5">>}}
            ]},
            {<<"CN779-787">>, [
                {rx2_rf, {786, <<"SF12BW125">>, <<"4/5">>}}
            ]},
            {<<"EU433">>, [
                {rx2_rf, {434.665, <<"SF12BW125">>, <<"4/5">>}}
            ]},
            {<<"AU915-928">>, [
                {rx2_rf, {923.3, <<"SF12BW500">>, <<"4/5">>}}
            ]},
            {<<"CN470-510">>, [
                {rx2_rf, {505.3, <<"SF12BW125">>, <<"4/5">>}}
            ]},
            {<<"KR920-923">>, [
                {rx2_rf, {921.9, <<"SF12BW125">>, <<"4/5">>}}
            ]},
            {<<"AS923-JP">>, [
                {rx2_rf, {923.2, <<"SF10BW125">>, <<"4/5">>}}
            ]}
        ]},
        % {sec, fcnt} after which the device status should be request
        % by default: 5 days or 4*24 frames
        {devstat_gap, {432000, 96}},
        {max_lost_after_reset, 10},
        % packet_forwarder's push_timeout_ms + transport + deduplication_delay
        {preprocessing_delay, 300},
        {deduplication_delay, 150},
        {event_lifetime, 86400}
    ]},
    {applications, [kernel, stdlib, sasl, os_mon, mnesia, lager, syn, worker_pool,
        cowboy, gun, jsx, iso8601, emqttc, lorawan_server_api]}]}.

% end of file
